#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>

int days1[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
int days2[13]={0,31,29,31,30,31,30,31,31,30,31,30,31};

int main(void)
{
	int year,frd,i,j;
	while(scanf("%d%d",&year,&frd))
	{
		if(year%4==0 && year%100!=0 || year%400==0)
		{
			for(i=1;i<=12;i++){
				int sum = 0;
				for(j=1;j<i;j++){
					sum+=days2[j];
				}
				sum+=12;
				if((sum+frd)%7==5)
					printf("%d-%d-13\n",year,i);
			}
		}
		else
		{
			for(i=1;i<=12;i++)
			{
				int sum = 0;
				for(j=1;j<i;j++){
					sum+=days1[j];
				}
				sum+=12;
				if((sum+frd)%7==5)
					printf("%d-%d-13\n",year,i);
			}
		}
	}	
	return 0;
}
